//== ENPULSE ===========================================================================

//== BEGINNING OF CODE ===============================================================

#ifndef __SAGITTARIUS_MACROS_H_
#define __SAGITTARIUS_MACROS_H_

//== INCLUDES ========================================================================

#include "sagittarius/core/SagittariusCommon.hpp"
#include "sagittarius/core/SagittariusConfigure.hpp"

//#include "boost/typeof/typeof.hpp" //can use BOOST_AUTO to determine iterator type
//Or use g++'s typeof

namespace Sagittarius
{
    template <class T>
    const T& GetConstRef(const T& t) { return t; }
}

//foreach
//iterator (should also return const_iterator when container is not modifiable)
#define ForEachI(container, it_name) for(typeof(container.begin()) it_name((container).begin()); it_name!=(container).end(); ++it_name)
//const_iterator
#define ForEachCI(container, it_name) for(typeof(GetConstRef(container).begin()) it_name((container).begin()); it_name!=(container).end(); ++it_name)

//non-typeof versions
//iterator
#define ForEachI_(container, container_type, it_name) for(container_type::iterator it_name((container).begin()); it_name!=(container).end(); ++it_name)
//const_iterator
#define ForEachCI_(container, container_type, it_name) for(container_type::const_iterator it_name((container).begin()); it_name!=(container).end(); ++it_name)

#endif
